<?php
class Controller_Default extends FLEA_Controller_Action
{ 
	private $_ModelNotice;
	private $siteInfo;
	
	function Controller_Default(){
		$this->siteInfo = FLEA::getAppInf('siteInfo');//get site information
		$this->_ModelNotice = & FLEA::getSingleton('Model_Notice');
	}
	
	function actionIndex(){
		$rbac =& FLEA::getSingleton('FLEA_Rbac');	
		$user = $rbac->getUser();//get login user's information
		if($user){
			redirect(url('User'));
		}
		
		$conditions = 'type = 1';
		$conditions2 = 'type = 2';
		$limit = 5;
		
		$list = $this->_ModelNotice->findAll($conditions,'',$limit);
		$list2 = $this->_ModelNotice->findAll($conditions2,'',$limit);
		
		$viewData = array(
			'siteInfo' => $this->siteInfo,
			'time' => date('Y-m-d H:i:s'),
			'list' => $list,
			'list2' => $list2,
		);
		$this->_executeView('Index.html',$viewData);
	}
}
?>